package com.cip.admin.service;

import com.cip.admin.model.User;
import com.cip.admin.service.UserExistsException;

import java.util.List;

/**
 * Web Service interface so hierarchy of Generic Manager isn't carried through.
 */

public interface UserService {
    /**
     * Retrieves a user by userId.  An exception is thrown if user not found
     *
     * @param userId the identifier for the user
     * @return User
     */
    User getUser( String userId);

    /**
     * Finds a user by their username.
     *
     * @param username the user's username used to login
     * @return User a populated user object
     */
    User getUserByUsername( String username) throws Exception;

    /**
     * Retrieves a list of all users.
     *
     * @return List
     */
    List<User> getUsers();

    /**
     * Saves a user's information
     *
     * @param user the user's information
     * @return updated user
     * @throws UserExistsException thrown when user already exists
     */
    User saveUser(User user) throws UserExistsException;

    /**
     * Removes a user from the database by their userId
     *
     * @param userId the user's id
     */
    void removeUser(String userId);
}
